package com.atbun.cmsservice.controller;


import com.atbun.cmsservice.service.CrmBannerService;
import com.atbun.cmsservice.entity.CrmBanner;
import com.atbun.commonutils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * 客户看到的页面数据
 * </p>
 *
 * @author testjava
 * @since 2020-05-13
 */
@Api(description = "网站首页Banner列表")
@RestController
@RequestMapping("/cmsservice/crmBannerFront")
public class CrmBannerFrontController {
    @Autowired
    private CrmBannerService crmBannerService;

    @Cacheable(value = "banner", key = "'selectIndexList'") //使用redis缓存
    @ApiOperation(value = "获取首页banner")
    @GetMapping("getAllBanner")
    public R index() {
        List<CrmBanner> list = crmBannerService.selectIndexList();
        return R.ok().data("bannerList", list);
    }

}

